﻿﻿/* **********************************************************************************
 * Copyright (c) 2011 John Hughes
 *
 * j9Script is licenced under the Microsoft Reciprocal License (Ms-RL).
 *
 * Project Website: http://j9Script.codeplex.com/
 * **********************************************************************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace J9Script.Internal
{
    internal class ScriptEvalutatorJumpStatementException : Exception
    {
        public readonly ScriptPosition Position;

        public ScriptEvalutatorJumpStatementException(ScriptPosition position)
        {
            this.Position = position;
        }
    }
    internal class ScriptEvaluatorGotoStatementException : ScriptEvalutatorJumpStatementException
    {
        public readonly string GotoLabel;

        public ScriptEvaluatorGotoStatementException(string gotoLabel, ScriptPosition position) : base(position)
        {
            this.GotoLabel = gotoLabel;
        }
    }

    internal class ScriptEvaluatorBreakStatementException : ScriptEvalutatorJumpStatementException
    {
        public ScriptEvaluatorBreakStatementException(ScriptPosition position) : base(position)
        {
        }
    }

    internal class ScriptEvaluatorContinueStatementException : ScriptEvalutatorJumpStatementException
    {
        public ScriptEvaluatorContinueStatementException(ScriptPosition position) : base(position)
        {
        }
    }

    internal class ScriptEvaluatorReturnStatementException : ScriptEvalutatorJumpStatementException
    {
        public readonly IScriptObject ReturnValue;

        public ScriptEvaluatorReturnStatementException(IScriptObject returnValue, ScriptPosition position) : base(position)
        {
            this.ReturnValue = returnValue;
        }
    }

    internal class ScriptEvaluatorEndStatementException : ScriptEvalutatorJumpStatementException
    {
        public ScriptEvaluatorEndStatementException(ScriptPosition position) : base(position)
        {
        }
    }
}
